﻿@{
    Layout = null;
}
<script src="@Url.Content("~/Content/js/jsTree/jquery.jstree.js")"></script>
<link href="~/Content/css/jsTree/themes/default/style.css" rel="stylesheet" />

<input type="hidden" name="selectedFolderId" id="selectedFolderId" value="" />
<div class="grid_12">
    <div id="folderTree"></div>
</div>
<script>
    $(document).ready(function () {
        $("#thuMucDuocChon").val("");

        $("#folderTree").jstree({
            "plugins": ["themes", "json_data", "ui"],
            "json_data": {
                "ajax": {
                    "url": "/TaiLieuGiangVien/GetThuMuc",
                    "data": function (n) {
                        return {
                            "maThuMucCha": n.attr ? n.attr("id") : null
                        };
                    }
                }
            }
        });
        $("#folderTree").bind("select_node.jstree", function (NODE, REF_NODE) {
            var a = $.jstree._focused().get_selected();
            $("#selectedFolderId").val(a.attr("id"));
            ChonThuMucDialog.SetThuMuc(a.attr("id"));
        });
    });

        var ChonThuMucDialog = new function () {
            this.MaThuMuc = null;
            this.SetThuMuc = function (maThuMuc) {
                this.MaThuMuc = maThuMuc;
            }
        }
</script>